
package com.gzbsoft.sc.modules.sys.service.impl;
import com.gzbsoft.sc.common.exception.RRException;
import com.gzbsoft.sc.modules.sys.dao.SysRoleDao;
import com.gzbsoft.sc.modules.sys.entity.SysMenu;
import com.gzbsoft.sc.modules.sys.entity.SysRole;
import com.gzbsoft.sc.modules.sys.service.SysMenuService;
import com.gzbsoft.sc.modules.sys.service.SysRoleService;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
/**
 * 角色
 *
 * @author Mark sunlightcs@gmail.com
 */
@Service
public class SysRoleServiceImpl extends BaseServiceImpl<SysRole, Long> implements SysRoleService {
    private final SysRoleDao sysRoleDao;
    private final SysMenuService sysMenuService;
    public SysRoleServiceImpl(SysRoleDao sysRoleDao, SysMenuService sysMenuService) {
        this.sysRoleDao = sysRoleDao;
        this.sysMenuService = sysMenuService;
    }
    @Override
    public void saveOrUpdate(Long id, List<SysMenu> menuList) {
        SysRole role = sysRoleDao.findById(id).orElseThrow(() -> new RRException("没有此角色"));
        role.setMenuList(menuList);
        sysRoleDao.update(role);
    }
}
